<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
String path = request.getContextPath();
String basepath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>临时交易车辆信息</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />
    <link href="<%=basepath%>css/index.css" rel="stylesheet" type="text/css">
    <link href="<%=basepath%>css/parking.css" rel="stylesheet" type="text/css">
    <script src="<%=basepath%>js/jquery-1.8.3.min.js"></script>
    <script src="<%=basepath%>js/layer/layer.js"></script>
    <script type="text/javascript" src="<%=basepath%>js/ajax-pushlet-client.js"></script>
</head>
<body>
<div class="viewport">
    <div id="buyer"></div>
    <form method="post" id="myForm" name="myForm" action="/wape-web/api/core/centerService">
        <input type="hidden" name="parkState" value="${cp.parkState}" />
        <c:if test="${cp.costType eq null or cp.costType eq '' }">
        <input type="hidden" name="serviceCode" value="MMZS110" />
        <input type="hidden" name="costType" value="40" />
        </c:if>
        <c:if test="${cp.costType ne null }">
        <input type="hidden" name="serviceCode"/>
        <input type="hidden" name="costType" value="${cp.costType}" />
        </c:if>
        <div class="header">
            <div class="header-1">
                <a href="javascript:void(0)" id="join" class="header-2">
                    <span id="account" class="account">${empty user.realName ? '' : user.realName}</span>&nbsp;&nbsp;<span id="deptName" class="deptName">${user.departmentName}</span>
                </a>
                <c:set var="rightIn" value=",200801,"></c:set>
                <c:set var="rightOut" value=",200801,"></c:set><!-- 2001,200101,200102,200103 -->
                <c:if test="${cp.parkState eq '0' and (fn:indexOf(rightIn, user.departmentId) != -1)}">
                    <span class="span-p"><input type="button" value="申请缴费" class="submit-1" id="fee"></span>
                    <script type="text/javascript">
                        $("#fee").click(function(){
                            layer.confirm('申请缴费，您确定？',{
                                icon: 3,
                                title:'申请缴费'
                            },function(sure){
                                layer.closeAll();
                                $('input[name="serviceCode"]').val("MMZS111");
                                $("#myForm").submit();
                            });
                        });
                    </script>
                </c:if>
                <c:if test="${cp.parkState eq '2' and (fn:indexOf(rightOut, user.departmentId) != -1)}">
                    <span class="span-p"><input type="button" value="车辆离场" class="submit-1" id="leave"></span>
                    <script type="text/javascript">
                        $("#leave").click(function(){
                            layer.confirm('车辆离场，您确定？',{
                                icon: 3,
                                title:'车辆离场'
                            },function(sure){
                                layer.closeAll();
                                $('input[name="serviceCode"]').val("MMZS113");
                                $("#myForm").submit();
                            });
                        });
                    </script>
                </c:if>
                <span class="span-num">WWP21300</span>
            </div>
        </div>
        <div class="blank"></div>
        <div class="content m-top">
            <div class="content2-1">
                <div class="content2-1-1">
                    <input type="hidden" name="storeId" value="${cp.storeId}" />
                    <input type="hidden" name="storeName" value="${cp.storeName}" />
                    <input type="hidden" name="sonStoreId" value="${cp.sonStoreId}" />
                    <input type="hidden" name="sonStoreName" value="${cp.sonStoreName}" />
                    <table>
                        <tr>
                            <td class="td-1">棚位分区：</td>
                            <td class="td-2">${cp.storeName}</td>
                            <td class="td-3">编号：</td>
                            <td class="td-4">${cp.sonStoreName}</td>
                        </tr>
                    </table>
                </div>
            </div>
            <c:if test="${cp.parkState eq '1' || cp.parkState eq '2'}">
                <div class="content2-1">
                    <div class="content2-1-1">
                        <table>
                            <tr>
                                <td class="td-1">调度员：</td>
                                <td class="td-2">${cp.dispatcherName}</td>
                                <td class="td-3">调度时间：</td>
                                <td class="td-4">${cp.dispatcherDay } ${cp.dispatcherTime }</td>
                            </tr>
                        </table>
                    </div>
                </div>
            </c:if>
            <c:if test="${cp.parkState eq '2'}">
                <div class="content2-1">
                    <div class="content2-1-1">
                        <table>
                            <tr>
                                <td class="td-1">收费员：</td>
                                <td class="td-2">${cp.chargerName_30 }</td>
                                <td class="td-3">收费时间：</td>
                                <td class="td-4">${cp.chargesDay_30 } ${cp.chargesTime_30 }</td>
                            </tr>
                        </table>
                    </div>
                </div>
            </c:if>
            <c:if test="${cp.payType eq '2'}">
                <div class="content2-1">
                    <div class="content2-1-1">
                        <table>
                            <tr>
                                <td class="td-1">车位状态：</td>
                                <td class="td-2">挪车位 </td>
                                <c:if test="${cp.syncTime ne null and cp.syncTime ne ''}">
                                    <td class="td-3">挪车时间：</td>
                                    <td class="td-4">${cp.syncTime }</td>
                                </c:if>
                            </tr>
                        </table>
                    </div>
                </div>
            </c:if>
            <div class="content2-2" id="tab">
                <c:if test="${cp.parkState eq '0' }">
                <a href="javascript:void(0)" class="span-1">车辆经营收费</a>
                <a href="javascript:void(0)" class="span-3">车位短租收费</a>
                <a href="javascript:void(0)" class="span-3 span-active">车位月租收费</a>
                </c:if>
                <c:if test="${cp.parkState ne '0' }">
                <a href="javascript:void(0)" class="span-3">车位月租收费</a>
                </c:if>
            </div>
            <div class="TAB">
                <div class="Tab bl-active">
                    <div class="content2-1">
                        <div class="content2-1-1">
                            <table>
                                <tr>
                                    <td class="td-1">承租人：</td>
                                    <td>
                                        <c:if test="${cp.parkState eq '1' || cp.parkState eq '2'}">
                                            <input type="text" value="${cp.plateNum}" readonly="readonly" class="input-2" name="plateNum" id="plateNum">
                                        </c:if>
                                        <c:if test="${cp.parkState eq '0'}">
                                            <input type="text" class="input-2" name="plateNum" id="plateNum" placeholder=" * 选填项">
                                        </c:if>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div class="content2-1">
                        <div class="content2-1-1">
                            <table>
                                <tr>
                                    <td class="td-1">联系电话：</td>
                                    <td>
                                        <c:if test="${cp.parkState eq '1' || cp.parkState eq '2'}">
			                                <c:if test="${(fn:indexOf(cp.inRecordNum, 'tmp_') != -1) }">
			                                    <input type="hidden" value="${cp.inRecordNum}" readonly="readonly" class="input-2"  name="inRecordNum" id="inRecordNum">
			                                </c:if>
			                                <c:if test="${(fn:indexOf(cp.inRecordNum, '_time_') != -1) }">
			                                ${fn:substring(cp.inRecordNum, 0, fn:indexOf(cp.inRecordNum, '_time_'))}
			                                <input type="hidden" value="${cp.inRecordNum}" readonly="readonly" class="input-2"  name="inRecordNum" id="inRecordNum">
			                                </c:if>
			                                <c:if test="${(fn:indexOf(cp.inRecordNum, 'tmp_') == -1) and (fn:indexOf(cp.inRecordNum, '_time_') == -1) }">
			                                    <input type="text" value="${cp.inRecordNum}" readonly="readonly" class="input-2"  name="inRecordNum" id="inRecordNum">
			                                </c:if>
                                        </c:if>
                                        <c:if test="${cp.parkState eq '0'}">
                                            <input type="text" class="input-2"  name="inRecordNum" id="inRecordNum" placeholder=" * 必填项">
                                        </c:if>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div class="content2-3"></div>
                    <div class="content2-1">
                        <div class="content2-1-1">
                            <table>
                                <tr>
                                    <td class="td-1">收费标准：</td>
                                    <td class="td-2">
                                        <c:if test="${cp.parkState eq '1' || cp.parkState eq '2'}">
                                            ${cp.rate}
                                        </c:if>
                                        <c:if test="${cp.parkState eq '0'}">
                                            <input type="text" value="150" class="input-2 text-r" name="rate" id="js-1" placeholder=" * 必填项" onkeyup="value=value.replace(/[^\d.]/g,'')">
                                        </c:if>
                                    </td>
                                    <td class="td-5">元/月</td>
                                    <td class="td-3">租赁月数：</td>
                                    <td class="td-4">
                                        <c:if test="${cp.parkState eq '1' || cp.parkState eq '2'}">
                                            ${cp.count}
                                        </c:if>
                                        <c:if test="${cp.parkState eq '0'}">
                                            <input type="text" value="1" class="input-2 text-r" name="count" readonly="readonly" id="js-2" placeholder=" * 必填项" onkeyup="value=value.replace(/[^\d.]/g,'')">
                                        </c:if>
                                    </td>
                                    <td class="td-6">月</td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div class="hr"></div>
                    <div class="content2-1">
                        <div class="content2-1-1">
                            <table>
                                <tr>
                                    <td class="td-1">应缴费用：</td>
                                    <td class="td-2">
                                        <c:if test="${cp.parkState eq '1' || cp.parkState eq '2'}">
                                            ${cp.costs}
                                        </c:if>
                                        <c:if test="${cp.parkState eq '0'}">
                                            <input type="text" class="input-2 text-r" name="costs" value="0" readonly="readonly" id="js-3" onkeyup="value=value.replace(/[^\d.]/g,'')">
                                        </c:if>
                                    </td>
                                    <td class="td-5">元&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                                    <td class="td-3">优惠金额：</td>
                                    <td class="td-4">
                                        <c:if test="${cp.parkState eq '1' || cp.parkState eq '2'}">
                                            ${cp.benefit}
                                        </c:if>
                                        <c:if test="${cp.parkState eq '0'}">
                                            <input type="text" class="input-2 text-r" name="benefit" autocomplete="off" value="0" id="js-4" onkeyup="value=(this.value.match(/^-?\d+\.?\d{0,2}$/)||[''])[0]">
                                        </c:if>
                                    </td>
                                    <td class="td-6">元</td>
                                </tr>
                            </table>
                        </div>
                    </div>
                    <div class="hr"></div>
                    <div class="content2-1">
                        <div class="content2-1-1">
                            <table>
                                <tr>
                                    <td class="td-1">实缴费用：</td>
                                    <td class="td-2">
                                        <c:if test="${cp.parkState eq '1' || cp.parkState eq '2'}">
                                            ${cp.payment}
                                        </c:if>
                                        <c:if test="${cp.parkState eq '0'}">
                                            <input type="text" class="input-2 text-r" name='payment' value="0" readonly="readonly" id="js-5" >
                                        </c:if>
                                    </td>
                                    <td class="td-5">元&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                                    <td class="td-3"></td>
                                    <td class="td-4">
                                        <input type="text" class="input-2" disabled="disabled" style="border:none;">
                                    </td>
                                    <td class="td-6"></td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <div class="content2-3"></div>
            <div class="blank"></div>
            <div class="content2-1">
                <div class="content2-1-1">
                    <table>
                        <tr>
                            <td class="td-1 bold">商品种类：</td>
                            <td class="td-2">
                                <c:if test="${cp.parkState eq '1' || cp.parkState eq '2'}">
                                    <input type="text" value="${cp.goodsKingdom}" class="input-2" name='goodsKingdom' placeholder="0" readonly="readonly" >
                                </c:if>
                                <c:if test="${cp.parkState eq '0'}">
                                    <!-- <input type="text" value="水果" class="input-2"  name="goodsKingdom" id="goodsKingdom" readonly="readonly"> -->
                                    <select name="goodsKingdom" id="select">
                                        <option value="水果" selected="selected">水果</option>
                                        <option value="蔬菜">蔬菜</option>
                                    </select>
                                </c:if>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="hr"></div>
            <div class="content2-1">
                <div class="content2-1-1">
                    <table>
                        <tr>
                            <td class="td-1 bold">商品名称：</td>
                            <td>
                                <c:if test="${cp.parkState eq '1' || cp.parkState eq '2'}">
                                    <input type="text" value="${cp.goodsInfo}" class="input-2 text-left" name="goodsInfo" readonly="readonly" id="goodsInfo">
                                </c:if>
                                <c:if test="${cp.parkState eq '0'}">
                                    <input type="text" class="input-2 text-left" name="goodsInfo" id="goodsInfo" readonly="readonly" placeholder=" * 必填项">
                                </c:if>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="blank"></div>
            <c:if test="${cp.parkState eq '0'}">
                <input type="hidden" id="sonid" name="son">
                <div class="content2-1-2">
                    <ul>
                        <c:forEach var="item" items="${goods}">
                            <li class="son" onclick="addFurit(this)"><a href='javascript:void(0)'>${item.son}</a><input type="hidden" value="${item.type}" class="furit"></li>
                        </c:forEach>
                        <li id="add-1"><a href="javascript:void(0)" class="a-add" id="add">✚</a></li>
                    </ul>
                </div>
            </c:if>
            <script type="text/javascript">
                $("#select").change(function(){
                    var a = $("#select option:selected").val();
                    if(a == "水果"){
                        $(".furit[value*='30']").parent(".son").addClass("bl-active");
                        $(".furit[value*='20']").parent(".son").removeClass("bl-active");
                        $(".son").removeClass("good");
                        $("#goodsInfo").attr("value","");
                    }
                    else if(a == "蔬菜"){
                        $(".furit[value*='20']").parent(".son").addClass("bl-active");
                        $(".furit[value*='30']").parent(".son").removeClass("bl-active");
                        $(".son").removeClass("good");
                        $("#goodsInfo").attr("value","");
                    }
                });
            </script>

            <c:if test="${cp.parkState eq '1' || cp.parkState eq '2'}">
                <div class="blank"></div>
                <div class="content2-5">
                    <div class="content2-5-1">
                        <c:set var="rightUserList" value=",13509917728,18718358884,15089649861,"></c:set>
                        <c:if test="${cp.parkState eq '1' and (fn:indexOf(rightUserList, user.atUserId) != -1) }"><!-- 未缴费,可以进行撤单 -->
                            <a href="javascript:;" class="a-3" id="cancell">撤销订单</a>
                        </c:if>
                        
                        <c:set var="rightMove" value=",200801,"></c:set>
                        <c:if test="${(cp.updateLock eq null or cp.updateLock eq '0') and (fn:indexOf(rightMove, user.departmentId) != -1) }"><!-- 未缴费、已缴费,可以进行可以换车位 -->
                            <a href="/wape-web/api/core/centerService?serviceCode=MMZS201&parkState=${cp.parkState }&sonStoreId=${cp.sonStoreId }" class="a-4" id="moveCar">挪车位</a>
                        </c:if>
                        <c:if test="${cp.updateLock eq '1' and (fn:indexOf(rightMove, user.departmentId) != -1) }"><!-- 未缴费、已缴费,可以进行可以换车位 -->
                            <a href=" javascript:;" class="a-4" style="background-color: grey; cursor: default;" id="moveCar">挪车位</a>
                        </c:if>
                        <c:set var="userRight" value=",15802037299,"></c:set>
                        <c:set var="departRight" value=",2002,200201,200202,"></c:set>
                        <c:if test="${cp.parkState eq '1' and ((fn:indexOf(userRight, user.atUserId) != -1) or (fn:indexOf(departRight, user.departmentId) != -1))}">
                            <td class="td-7">
                                <a href=" javascript:;" class="a-4" style="background-color: grey; cursor: default;" id="doCharge">确认缴费</a>
                            </td>
                        </c:if>
                    </div>
                </div>
            </c:if>
            <div class="content2-2"><div class="content2-2-1"><span>其他备注情况</span></div></div>
            <div class="content2-4">
                <c:if test="${cp.parkState eq '1' || cp.parkState eq '2'}">
                    ${cp.remark}
                </c:if>
                <c:if test="${cp.parkState eq '0'}">
                    <textarea name="remark" rows="" cols=""></textarea>
                </c:if>
            </div>
            <div class="space"></div>

        </div>
    </form>
</div>
</body>
<script type="text/javascript">
    /*错误提示*/
    $(function(){
        var error = "${requestScope.returnMsg}";
        if(error != "" && error != "成功!"){
            layer.msg(error,{shadeClose:true,shade:0.1,time:2000});
        }
    });
    /*添加*/
    $(function(){
        $(".son").click(function(){
            $(this).toggleClass("good");
        });
        $(".furit[value*='30']").parent(".son").addClass("bl-active");
        $(".furit[value*='20']").parent(".son").removeClass("bl-active");
    });
    function addFurit(a){
        var good = $(a).text();
        var gival = $("#goodsInfo").val();
        var idx = gival.indexOf(good);
        var adv = "," + good;
        var tv = (gival + adv);
        if(idx == -1){
            if(tv.indexOf(",") == 0){
                tv = tv.substring(1);
            }
            $("#goodsInfo").val(tv);
        }else{
            if(gival.indexOf(",") == 0){
                var va = gival.replace(good,"");
                if(va.indexOf(",") == 0){
                    va = va.substring(1);
                }
                $("#goodsInfo").val(va);
            }else{
                var va = gival.replace(adv,"");
                var va = va.replace(good,"");
                if(va.indexOf(",") == 0){
                    va = va.substring(1);
                }
                $("#goodsInfo").val(va);
            }

        }
    }
    /*添加*/
    $(function(){
        $("#add").click(function(){
            layer.prompt({
                title: '请输入商品名称',
                formType: 0
            }, function(text){
                if(text != ""){
                    layer.load();
                    var selectType = $("#select option:selected").val();
                    $.ajax({
                        type:"post",
                        url:"/wape-web/api/core/centerService",
                        data:{
                            serviceCode:"3000P02",
                            son:text,
                            fatherName:selectType
                        },
                        success:function(data){
                            var add = eval("("+data+")");
                            if(add.returnCode == "200"){
                                var a = $("#select option:selected").val();
                                if(a == "水果"){
                                    $("#add-1").before("<li class='son bl-active' onclick='addFurit(this)'><a href='javascript:void(0)'>"+text+"</a><input type='hidden' value='30' class='furit'></li>");
                                }
                                else if(a == "蔬菜"){
                                    $("#add-1").before("<li class='son bl-active' onclick='addFurit(this)'><a href='javascript:void(0)'>"+text+"</a><input type='hidden' value='20' class='furit'></li>");
                                }
                            }
                            else if(add.returnCode == "W2001"){
                                layer.msg("商品已存在",{shadeClose:true,shade:0.1,time:2000});
                            }
                            else{
                                layer.msg("添加失败!",{shadeClose:true,shade:0.1,time:2000});
                            }
                        }
                    });
                }
                layer.closeAll();
            });
        })
    });
    "/*Tab*/"
    $(function(){
        $("#tab a").click(function(){
        	var _index = $(this).index();
            if(_index == 0) {
                $('input[name="costType"]').val("10");
                var frm = document.forms['myForm'];
                frm.submit();
            } else if(_index == 1) {
                $('input[name="costType"]').val("30");
                var frm = document.forms['myForm'];
                frm.submit();
            } else if(_index == 2) {
                $('input[name="costType"]').val("40");
                var frm = document.forms['myForm'];
                frm.submit();
            }
            //$(this).addClass("span-active").siblings().removeClass("span-active");
            //$(".TAB .Tab").addClass("bl-active").siblings().removeClass("bl-active");
            //$('.TAB .Tab:eq('++')').fadeIn().siblings().hide();
        });
    });
    /*计算*/
    $(function(){
    	var _parkState = '${cp.parkState}';
    	if(_parkState == '0') {
	    	var s1 = $("#js-1").val();
		    var s2 = $("#js-2").val();
		    var s4 = $("#js-4").val();
		    var s3 = Math.round(s1*s2*100)/100;
		    $("#js-3").val(s3);
		    var s5 = Math.floor(Number(s3)-Number(Math.round(s4)));
		    $("#js-5").val(s5);
		    
	        $("#js-1").keyup(function(){
	            var s1 = $("#js-1").val();
	            var s2 = $("#js-2").val();
	            var s4 = $("#js-4").val();
	            var s3 = Math.round(s1*s2*100)/100;
	            $("#js-3").val(s3);
	            var s5 = Math.floor(Number(s3)-Number(Math.round(s4)));
	            $("#js-5").val(s5);
	        });
	        
	        $("#js-2").keyup(function(){
	            var s1 = $("#js-1").val();
	            var s2 = $("#js-2").val();
	            var s4 = $("#js-4").val();
	            var s3 = Math.round(s1*s2*100)/100;
	            $("#js-3").val(s3);
	            var s5 = Math.floor(Number(s3)-Number(Math.round(s4)));
	            $("#js-5").val(s5);
	        });
	
	        $("#js-4").keyup(function(){
	            var s1 = $("#js-1").val();
	            var s2 = $("#js-2").val();
	            var s4 = $("#js-4").val();
	            var s3 = Math.round(s1*s2*100)/100;
	            $("#js-3").val(s3);
	            var s5 = Math.floor(Number(s3)-Number(Math.round(s4)));
	            if(s5 < 0) {
	                layer.msg("优惠金额应小于应缴金额",{shadeClose:true,shade:0.1,time:2000});
	                $("#js-4").val('0');
	                s5 = s1*s2;
	            }
	            $("#js-5").val(s5);
	        });
    	}
    });
    /*撤销订单*/
    $(function(){
        $("#cancell").click(function(){
            layer.confirm('是否撤销？',{
                icon: 3,
                title:'撤销单据'
            },function(sure){
                layer.closeAll();
                $('input[name="serviceCode"]').val('MMZS128');
                var frm = document.forms['myForm'];
                var url = '/wape-web/api/core/centerService?inRecordKey=${cp.inRecordKey }';
                frm.action = url;
                frm.submit();
            });
        });
        
        $("#doCharge").click(function(){
            layer.confirm('是否确认缴费？',{
                icon: 3,
                title:'确认缴费'
            },function(sure){
                layer.closeAll();
                $('input[name="serviceCode"]').val('MMZS121');
                var frm = document.forms['myForm'];
                var url = '/wape-web/api/core/centerService?inRecordKey=${cp.inRecordKey }';
                frm.action = url;
                frm.submit();
            });
        });
    });
    /*提交表单*/
    $("#myForm").submit(function(){
        var plateNum = $("#plateNum").val();
        var js1 = $("#js-1").val();
        var js2 = $("#js-2").val();
        var js3 = $("#js-3").val();
        var js4 = $("#js-4").val();
        var js5 = $("#js-5").val();
        var goodsInfo = $("#goodsInfo").val();
        if(plateNum == ""){
            layer.msg("请输入承租人姓名",{shadeClose:true,shade:0.1,time:2000});
            return false;
        }
        else if(js1 == ""){
            layer.msg("收费标准为0",{shadeClose:true,shade:0.1,time:2000});
            return false;
        }
        else if(js2 == ""){
            layer.msg("请输入实际吨数",{shadeClose:true,shade:0.1,time:2000});
            return false;
        }
        else if(js3 == ""){
            layer.msg("应交费用为0",{shadeClose:true,shade:0.1,time:2000});
            return false;
        }
        else if(js4 == ""){
            layer.msg("请输入优惠金额",{shadeClose:true,shade:0.1,time:2000});
            return false;
        }
        else if(js5 == ""){
            layer.msg("实缴费用为0",{shadeClose:true,shade:0.1,time:2000});
            return false;
        }
        else if(goodsInfo == ""){
            layer.msg("请选择商品名称",{shadeClose:true,shade:0.1,time:2000});
            return false;
        }
        else{
            layer.load();
            setTimeout(function(){
                layer.closeAll();
                layer.msg("网络异常，请重新尝试！",{shadeClose:true,shade:0.1,time:2000});
            }, 30000);
        }
    });
</script>
<script type="text/javascript">

    var sonStoreId = '${cp.sonStoreId}';
    var parkState = '${cp.parkState}';
    var departmentId = '${user.departmentId}';
    var right = ',2001,200101,200102,200103,';
    if((parkState == '1' || parkState == '2') && right.indexOf(',' + departmentId + ',') != -1) {
        //初始化pushlet客户端
        PL._init();
        //设定运行时显示调试信息，不需要时，直接删掉即可
        PL.setDebug(false);
        //设定监听主题：/wape/updateCarLock, 与服务器端的主题完全一致
        PL.joinListen('/wape/updateCarLock');
        //接收到事件后，显示服务器信息
        function onData(event) {
            var _currSonStoreId = event.get("currSonStoreId");
            var _locked = event.get("locked");
            if(_locked == '1' && _currSonStoreId == sonStoreId) {
                $('#moveCar').attr('href', 'javascript:;');
                $('#moveCar').attr('style', 'background-color: grey; cursor: default;');
            } else {
                $('#moveCar').attr('href', '/wape-web/api/core/centerService?serviceCode=MMZS201&parkState=${cp.parkState }&sonStoreId=${cp.sonStoreId }');
                $('#moveCar').removeAttr('style');
            }
        }
        //p_publish('/wape/updateCarLock', 'hw', 'test message!');
    }
</script>
</html>


